package Dungeoneering.api.wrappers;

import org.powerbot.game.api.methods.interactive.Players;
import org.powerbot.game.api.wrappers.Tile;
import org.powerbot.game.api.wrappers.interactive.Player;

import Dungeoneering.Entities.Room;
import Dungeoneering.PathFinding.PathProcessor;

/**
 * Our player class. It is a normal Player, but with a couple of added features like getCurrentRoom
 * @author Nicolaas
 *
 */
public class MyPlayer extends Player {
	
	private static MyPlayer player;
	
	private boolean hasHex;

	private MyPlayer() {
		super(Players.getLocal());
	}
	
	public static MyPlayer getPlayer() {
		if (player == null)
			player = new MyPlayer();
		return player;
	}

	public Room getCurrentRoom() {
		Tile position = MyPlayer.getPlayer().getLocation();
		for (Room r : PathProcessor.getRooms()) {
			if (r.containsTile(position.getX(), position.getY()))
				return r;
		}
		return null;
	}
	
	public void hasHexhunter(boolean hasHex) {
		this.hasHex = hasHex;
	}
	
	public boolean hasHexhunter() {
		return hasHex;
	}
}
